/*     */ package nccloud.web.qc.pub.reportandrejectbill;
/*     */ 
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Set;
/*     */ import nc.vo.qc.c002.entity.CheckBillViewVO;
/*     */ import nc.vo.scmpub.util.ArrayUtil;
/*     */ import nc.vo.scmpub.util.ListUtil;
/*     */ import nccloud.dto.qc.reportandreject.entity.CheckInfoTabCell;
/*     */ import nccloud.dto.qc.reportandreject.entity.CheckInfoTabGridModel;
/*     */ import nccloud.dto.qc.reportandreject.entity.CheckInfoTabItem;
/*     */ import nccloud.dto.qc.reportandreject.entity.CheckInfoTabRow;
/*     */ import nccloud.framework.service.ServiceLocator;
/*     */ import nccloud.framework.web.ui.config.Item;
/*     */ import nccloud.framework.web.ui.meta.ComponentType;
/*     */ import nccloud.framework.web.ui.model.GridModel;
/*     */ import nccloud.framework.web.ui.model.row.Cell;
/*     */ import nccloud.framework.web.ui.model.row.Row;
/*     */ import nccloud.framework.web.ui.pattern.grid.Grid;
/*     */ import nccloud.pubitf.qc.reportandreject.service.ICheckInfoTabServiceForNCC;
/*     */ import nccloud.web.qc.pub.entity.CheckInfoMultiTab;
/*     */ import nccloud.web.qc.pub.entity.CheckInfoMultiTabDTO;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class CheckInfoTabClientAdapter
/*     */ {
/*     */   private ICheckInfoTabServiceForNCC service;
/*     */   private String itemInfoAreaCode;
/*     */   private String sampleInfoAreaCode;
/*     */   private CheckBillViewVO[] checkviews;
/*     */   
/*     */   public CheckInfoTabClientAdapter(CheckBillViewVO[] checkviews, String checkInfoAreaCode, String sampleInfoAreaCode) {
/*  41 */     this.checkviews = null;
/*     */ 
/*     */ 
/*     */ 
/*     */     
/*  46 */     this.checkviews = checkviews;
/*  47 */     this.itemInfoAreaCode = checkInfoAreaCode;
/*  48 */     this.sampleInfoAreaCode = sampleInfoAreaCode;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public CheckInfoMultiTabDTO buildDTOwithTabs() {
/*  57 */     CheckInfoMultiTabDTO dto = new CheckInfoMultiTabDTO();
/*  58 */    // CheckInfoMultiTab checkInfoTab = buildItemInfoTab();
/*  59 */     //CheckInfoMultiTab sampleInfoTab = buildSampleInfoTab();
/*  60 */     //dto.addTab(this.itemInfoAreaCode, checkInfoTab);
/*  61 */     //dto.addTab(this.sampleInfoAreaCode, sampleInfoTab);
/*  62 */     return dto;
/*     */   }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public CheckInfoMultiTab buildItemInfoTab() {
/*  71 */     Item[] template = CreateIteminfoTemplate();
/*  72 */     Grid grid = CreateIteminfoTabData();
/*  73 */     return new CheckInfoMultiTab(template, grid);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*  78 */   private Item[] CreateIteminfoTemplate() { return CreateTemplate(this.itemInfoAreaCode); }
/*     */ 
/*     */ 
/*     */   
/*  82 */   private Grid CreateIteminfoTabData() { return CreateData(this.itemInfoAreaCode); }
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public CheckInfoMultiTab buildSampleInfoTab() {
/*  91 */     Item[] template = CreateSampleinfoTemplate();
/*  92 */     Grid grid = CreateSampleinfoTabData();
/*  93 */     return new CheckInfoMultiTab(template, grid);
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*  98 */   private Item[] CreateSampleinfoTemplate() { return CreateTemplate(this.sampleInfoAreaCode); }
/*     */ 
/*     */ 
/*     */   
/* 102 */   private Grid CreateSampleinfoTabData() { return CreateData(this.sampleInfoAreaCode); }
/*     */ 
/*     */ 
/*     */   
/*     */   private Grid CreateData(String areacode) {
/* 107 */     CheckInfoTabGridModel data = getService().getData(this.checkviews, this.itemInfoAreaCode, this.sampleInfoAreaCode, areacode);
/*     */     
/* 109 */     if (null == data || ListUtil.isEmpty(data.getRows())) {
/* 110 */       return null;
/*     */     }
/* 112 */     List<CheckInfoTabRow> rows = data.getRows();
/* 113 */     GridModel gridModel = new GridModel();
/* 114 */     gridModel.setAreacode(areacode);
/* 115 */     for (CheckInfoTabRow checkInfoTabRow : rows) {
/* 116 */       Map<String, CheckInfoTabCell> values = checkInfoTabRow.getValues();
/* 117 */       Row row = new Row();
/* 118 */       Set<Map.Entry<String, CheckInfoTabCell>> entrySet = values.entrySet();
/* 119 */       for (Map.Entry<String, CheckInfoTabCell> entry : entrySet) {
/* 120 */         String name = (String)entry.getKey();
/* 121 */         CheckInfoTabCell checkInfoTabCell = (CheckInfoTabCell)entry.getValue();
/* 122 */         Cell cell = new Cell();
/* 123 */         cell.setDisplay(checkInfoTabCell.getDisplay());
/* 124 */         cell.setValue(checkInfoTabCell.getValue());
/* 125 */         cell.setScale(checkInfoTabCell.getScale());
/* 126 */         row.addCell(name, cell);
/*     */       } 
/* 128 */       gridModel.add(row);
/*     */     } 
/* 130 */     Grid grid = new Grid();
/* 131 */     grid.setModel(gridModel);
/* 132 */     return grid;
/*     */   }
/*     */   
/*     */   private Item[] CreateTemplate(String areacode) {
/* 136 */     CheckInfoTabItem[] template = getService().getTemplate(this.checkviews, this.itemInfoAreaCode, this.sampleInfoAreaCode, areacode);
/*     */     
/* 138 */     if (ArrayUtil.isEmpty(template)) {
/* 139 */       return null;
/*     */     }
/* 141 */     Item[] items = new Item[template.length];
/* 142 */     for (int i = 0; i < template.length; i++) {
/* 143 */       CheckInfoTabItem checkInfoTabItem = template[i];
/* 144 */       Item item = new Item();
/* 145 */       item.setCode(checkInfoTabItem.getCode());
/* 146 */       item.setLabel(checkInfoTabItem.getLabel());
/* 147 */       item.setMaxlength(20);
/* 148 */       item.setDatatype(0);
/* 149 */       item.setAreaid(areacode);
/* 150 */       item.setItemtype(ComponentType.Input);
/* 151 */       item.setDisabled(false);
/* 152 */       item.setVisible(true);
/* 153 */       items[i] = item;
/*     */     } 
/* 155 */     return items;
/*     */   }
/*     */   
/*     */   private ICheckInfoTabServiceForNCC getService() {
/* 159 */     if (null == this.service) {
/* 160 */       this.service = (ICheckInfoTabServiceForNCC)ServiceLocator.find(ICheckInfoTabServiceForNCC.class);
/*     */     }
/* 162 */     return this.service;
/*     */   }
/*     */ }


/* Location:              E:\zhuhai_ncc\NCC2111\external\li\\uiqc_nccloud.jar!/nccloud/web/qc/pub/reportandrejectbill/CheckInfoTabClientAdapter.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.0.7
 */